home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / MotifApp / AskFirstCmd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-17  |  1.8 KB  |  59 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////
  3. //         This example code is from the book:
  4. //
  5. //           Object-Oriented Programming with C++ and OSF/Motif
  6. //         by
  7. //           Douglas Young
  8. //           Prentice Hall, 1992
  9. //           ISBN 0-13-630252-1    
  10. //
  11. //         Copyright 1991 by Prentice Hall
  12. //         All Rights Reserved
  13. //
  14. //  Permission to use, copy, modify, and distribute this software for 
  15. //  any purpose except publication and without fee is hereby granted, provided 
  16. //  that the above copyright notice appear in all copies of the software.
  17. ///////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19.  
  20.  
  21. ///////////////////////////////////////////////////////////////
  22. // AskFirstCmd.h: Base class for Cmds that ask for confirmation
  23. ////////////////////////////////////////////////////////////////
  24. #ifndef ASKFIRSTCMD_H
  25. #define ASKFIRSTCMD_H
  26. #include "Cmd.h"
  27.  
  28. class AskFirstCmd : public Cmd {
  29.     
  30.   private:
  31.     
  32.     // Callback for the yes choice on the dialog
  33.     
  34.     static void yesCallback ( void * );
  35.     
  36.     //  Derived classes should use setQuestion to change
  37.     // the string displayed in the dialog
  38.     
  39.     char *_question;
  40.  
  41. #ifndef CPLUSPLUS2_1
  42.   protected:    
  43.  
  44.     virtual void doit()   = 0;  // Specific actions must be defined    
  45.     virtual void undoit()   = 0;  // Specific actions must be defined    
  46. #endif
  47.  
  48.   public:
  49.     
  50.     AskFirstCmd ( char *, int );
  51.     
  52.     void setQuestion ( char *str );
  53.     
  54.     virtual void execute(); // Overrides the Cmd member function
  55.     
  56.     virtual const char *const className ()  { return "AskFirstCmd"; }
  57. };
  58. #endif
  59.